<?php

class Stock {


	private $res_stock;
	private $q;

	public function mod_stock($idcama, $id_mat, $asumar ){
		$this->q = "update stocks
				set stock = stock + $asumar
				where id_cama = $idcama
				and id_material = $id_mat";
		Database::query_baja($this->q);
		
	}

	public function a_stock($idcama, $id_mat, $stock){
		$this->q = "insert into stocks (id_cama, id_material, stock)
				values ($idcama, $id_mat, $stock)";
		
		Database::query_baja($this->q);
	}




	public function sel_stock($id_material,$id_cama){

	$this->q = "select * from stocks where id_cama = $id_cama and id_material = $id_material";
	$this->res_stock = Database::query_simple($this->q);
	return $this->res_stock;
	}

	public function put_stock($id_material,$id_cama,$cantidad){

	$this->q = "insert into stocks  (id_material,id_cama,stock) values ($id_material,$id_cama,$cantidad)  ";
	$this->res_stock = Database::query_baja($this->q);
	
	return $this->res_stock;
	}

	public function actualizar_stock($id_material,$id_cama,$cantidad){	
	$this->q = "update stocks set stock = stock + $cantidad where id_cama = $id_cama and id_material = $id_material";
	$this->res_stock = Database::query_baja($this->q);
	
	return $this->res_stock;
	}





}

?>